package com.neu.app;

import com.neu.view.UserView;
import com.neu.view.impl.AdminView;
import com.neu.view.impl.MemberView;

import java.util.Map;

import static com.neu.util.Read.*;
public class App {
    public static void main(String[] args) {
        System.out.println("*************************************");
        System.out.println("*\t\t欢迎使用胡Sir家庭记账单\t\t*");
        System.out.println("*************************************");
        while (true) {
            System.out.println("请选择登陆：");
            System.out.println("1.登陆后台");
            System.out.println("2.使用登陆");
            System.out.println("3.退出程序");
            System.out.print("请选择：");
            int n=getIn().nextInt();
            UserView userView = null;
            switch(n){
                case 1:
                    userView = new AdminView();
                    break;
                case 2:
                    userView = new MemberView();
                    break;
                case 3:
                    System.exit(0);
                    break;
                default:
                    System.out.println("请正确输入!");
                    break;
            }
            if (userView == null){
                continue;
            }
            Map<String,Object> map =userView.login();
            if (map!=null){
                userView.setInfo(map);
                userView.menu();
            }else{
                System.out.println("用户名和密码有误");
            }
        }
    }
}
